package com.zx.mes.hyl.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.zx.mes.hyl.pagemodel.TreeNode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 实现 spring security UserDetails 接口
 * </p>
 *
 * @author 华云龙
 * @since 2018-07-09
 */
public class SysUser extends Model<SysUser>{

    private static final long serialVersionUID = 1L;

    private String id;
    private String name;
    @TableField("createDateTime")
    private Date createDateTime;
    @TableField("modifyDateTime")
    private Date modifyDateTime;
    private String password;

    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField(exist=false)
    private Date createDateTimeStart;

    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField(exist=false)
    private Date createDatetimeEnd;

    @TableField(exist = false)
    private List<SysRole> roleList = new ArrayList<>();

    @TableField(exist = false)
    private List<TreeNode> treeNodeList = new ArrayList<>();

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreateDateTime() {
        return createDateTime;
    }

    public void setCreateDateTime(Date createDateTime) {
        this.createDateTime = createDateTime;
    }

    public Date getModifyDateTime() {
        return modifyDateTime;
    }

    public void setModifyDateTime(Date modifyDateTime) {
        this.modifyDateTime = modifyDateTime;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Date getCreateDateTimeStart() {
        return createDateTimeStart;
    }

    public void setCreateDateTimeStart(Date createDateTimeStart) {
        this.createDateTimeStart = createDateTimeStart;
    }

    public Date getCreateDatetimeEnd() {
        return createDatetimeEnd;
    }

    public void setCreateDatetimeEnd(Date createDatetimeEnd) {
        this.createDatetimeEnd = createDatetimeEnd;
    }


    public List<SysRole> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<SysRole> roleList) {
        this.roleList = roleList;
    }

    public List<TreeNode> getTreeNodeList() {
        return treeNodeList;
    }

    public void setTreeNodeList(List<TreeNode> treeNodeList) {
        this.treeNodeList = treeNodeList;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "SysUser{" +
        "id=" + id +
        ", name=" + name +
        ", createDateTime=" + createDateTime +
        ", modifyDateTime=" + modifyDateTime +
        ", password=" + password +
        "}";
    }
}
